import request from "@/utils/request";
import { download, downloadOfGet } from "@/utils/request";

// 查询故障树列表-上表
export function getTreeListById(params) {
  return request({
    url: "/faultTree/getFaultTreeBasicDeviceData",
    method: "get",
    params,
  });
}
// 查询明细-下列表
export function getFaultTreeData(data) {
  return request({
    url: "/faultTree/getFaultTreeData",
    method: "post",
    data,
  });
}
// 查询明细-下列表
export function getFaultTreeDetailData(data) {
  return request({
    url: "/faultTree/getFaultTreeDetailData",
    method: "post",
    data,
  });
}
// 获取公式
export function createRule(params) {
  return request({
    url: "/deviceDiagnoseBasic/deviceDiagnoseBasic/createRule",
    method: "get",
    params,
  });
}
// 测点绑定下拉框列表
export function getPointListByDeviceCode(params) {
  return request({
    url: "/point/getPointListByDeviceCode",
    method: "get",
    params,
  });
}
// 测点绑定选择后保存
export function savePointData(params) {
  return request({
    url: "/point/getPointListByDeviceCode",
    method: "get",
    params,
  });
}

// 诊断规则配置弹窗
export function getDiagnoseRuleList(params) {
  return request({
    url: "/diagnoseRuleConfig/diagnoseRuleConfig/list",
    method: "get",
    params,
  });
}
// 诊断规则配置 新增
// export function addDiagnoseRule(data) {
//   return request({
//     url: "/DiagnoseRuleConfig/DiagnoseRuleConfig",
//     method: "post",
//     data,
//   });
// }
// 诊断规则配置 修改
// export function editDiagnoseRule(data) {
//   return request({
//     url: "/diagnoseRuleConfig/diagnoseRuleConfig/subminBatch",
//     method: "post",
//     data,
//   });
// }

export function editDiagnoseRule(data) {
  return request({
    url: "/deviceDiagnoseBasic/deviceDiagnoseBasic",
    method: "post",
    data,
  });
}

// 诊断规则配置 导出
export function exportDiagnoseRule(filename, config) {
  return downloadOfGet(
    "/diagnoseRuleConfig/diagnoseRuleConfig/export",
    filename,
    config
  );
}
